package com.example.maruko_course_backend.convertor;

import com.example.maruko_course_backend.vo.KnowledgeItemVo;

import java.util.ArrayList;
import java.util.List;

public class KnowledgeVoConvertor {
  
  public List<KnowledgeItemVo> filterToDisplayItemVo(List<KnowledgeItemVo> itemsVo, List<String> displayedTop10ItemVo) {
    List<KnowledgeItemVo> resultVo = new ArrayList<>();
    for (int i = 0; i < itemsVo.size(); i++) {
      List<String> checkItemVoList = displayedTop10ItemVo.subList(0, Math.min(10 - i, displayedTop10ItemVo.size()));
      if (!checkItemVoList.contains(itemsVo.get(i).getContent())) {
        resultVo.add(itemsVo.get(i));
      }
    }
    return resultVo;
  }
}
